package jdk15;

/**
 * JDK 17 新特性：文本块
 */
public class TextBlockDemo {
    /**
     * JDK 8 写法
     */
    public static String getHtmlByJDK8() {
        return "<!DOCTYPE html>\n" +
                "<html lang=\"en\">\n" +
                "<head>\n" +
                "    <meta charset=\"UTF-8\">\n" +
                "    <title>Hello JDK17</title>\n" +
                "</head>\n" +
                "<body>\n" +
                "    <h1>Hello JDK 17</h1>\n" +
                "</body>\n" +
                "</html>";
    }

    /**
     * JDK 17 写法
     */
    public static String getHtmlByJDK17() {
        return """
                <!DOCTYPE html>
                <html lang="en">
                <head>
                    <meta charset="UTF-8">
                    <title>Hello JDK17</title>
                </head>
                <body>
                    <h1>Hello JDK 17</h1>
                </body>
                </html>
                """;
    }

    public static void main(String[] args) {
        System.out.println(getHtmlByJDK8());
        System.out.println("==============");
        System.out.println(getHtmlByJDK17());
    }
}
